ID
Reports the unique ID number assigned to an object(glossary).Syntax: get the long | abbr[ev[iated] | short }] ID of Examples: send mouseUp to button ID 2214 set the ID of image "Custom Cursor" to 2314 put the long ID of this card into savedID Use an object's ID property to refer to the object(glossary) in an unambiguous way. A stack's ID is equal to the ID that will be assigned to the next object(glossary) created within that stack, so the stack ID is subject to change. You can set the ID of a stack, but only to a greater number than its current ID. You can set the ID of an image. Be careful not to set an image ID to a number that's the ID of another object(glossary) in the same stack : since LiveCode uses IDs to keep track of objects, a conflict may prevent LiveCode from being able to access one or both objects. The following ID numbers are reserved and should not be used for image IDs: * 1-100: reserved for built-in cursors * 101-135: reserved for built-in brush shapes * 236-300: reserved for built-in patterns * 301-1000: reserved for built-in icons * 101,000-103,000: reserved * 200,000-299,999: reserved for application use For all other objects, the ID property is assigned when the object(glossary) is created and never changes. This means that for all objects except stacks and images, the ID property is guaranteed to be persistent. An object's name or number may change, but its ID does not. For all objects, the ID is guaranteed to be unique within a stack. IDs are not reused if the object(glossary) is deleted. An object(glossary) that is created by copying and pasting, or with the copy command, is assigned a new ID. If you cut an object(glossary) and paste it into the same stack, it retains its original ID. The short ID of an object is its ID number. If you don't specify a modifier for the ID property, you get the short ID form. The abbreviated ID of an object is the object's type, followed by "id", followed by the object's short ID. For example, if a button's short ID is "27", its abbreviated ID is "button id 27". The long id of an object includes information about its owner (and about the owner of that object(glossary), and so forth). For example, suppose a stack named "My Stack" contains a card whose ID is 11. This card has a group whose ID is 28, which in turn contains a button whose ID is 34. The card also has a card field whose ID is 46. If "My Stack" is a main stack and it's in a file whose path is "/Drive/Folder/Stack. rev", the long IDs of these objects look like this: * The stack: stack "/Drive/Folder/Stack. rev" * The group: group id 28 of card ID 11 of stack "/Drive/Folder/Stack. rev" * The card: card id 11 of stack "/Drive/Folder/Stack. rev" * The grouped button: button id 34 of group id 28 of card id 11 of stack "/Drive/Folder/Stack. rev" * The card field: field id 46 of card id 11 of stack "/Drive/Folder/Stack. rev" If the stack is a substack, its ID is included in the long name of each of its objects, before the path of the main stack. The long ID of a group includes the ID of the current card. If the group does not appear on the current card, requesting its ID causes an execution error. If you need to get the ID of a group, use the "background" terminology instead. The long ID of a background includes the ID of the current card, if the background appears on the current card. If not, the long ID of the background includes the ID of the first card the background appears on. If an object's name is empty, getting its name yields its ID property instead. If a stack was originally created with HyperCard and then imported into LiveCode, the ID of each control in the stack is guaranteed unique only within its domain. (You can check a stack's HCStack property to determine whether it began life in HyperCard. ) If a stack's HCAddressing property is set to true, the long or abbreviated ID of a control in that stack begins with the word "background" if the control is part of a group, and with the word "card" if not. See also: push (command),stacks (function),number (function),stack (object),image (object),name (property),HCAddressing (property),owner (property),groupIDs (property),HCStack (property),altID (property),cardIDs (property), Category: objects